package yang.model;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * ChufangInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "chufang_info", catalog = "hospital")
public class ChufangInfo implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String id;//UUID
	private PatientInfo patientInfo;//关联的挂号单表
	private Timestamp creatDate;//创建时间
	private Double totalPrice;//总价
	private Set<ChufangItmes> chufangItmeses = new HashSet<ChufangItmes>(0);

	// Constructors

	/** default constructor */
	public ChufangInfo() {
	}

	/** minimal constructor */
	public ChufangInfo(String id) {
		this.id = id;
	}

	/** full constructor */
	public ChufangInfo(String id, PatientInfo patientInfo, Timestamp creatDate,
			Double totalPrice, Set<ChufangItmes> chufangItmeses) {
		this.id = id;
		this.patientInfo = patientInfo;
		this.creatDate = creatDate;
		this.totalPrice = totalPrice;
		this.chufangItmeses = chufangItmeses;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false, length = 36)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "patient_id")
	public PatientInfo getPatientInfo() {
		return this.patientInfo;
	}

	public void setPatientInfo(PatientInfo patientInfo) {
		this.patientInfo = patientInfo;
	}

	@Column(name = "creat_date", length = 19)
	public Timestamp getCreatDate() {
		return this.creatDate;
	}

	public void setCreatDate(Timestamp creatDate) {
		this.creatDate = creatDate;
	}

	@Column(name = "total_price", precision = 22, scale = 0)
	public Double getTotalPrice() {
		return this.totalPrice;
	}

	public void setTotalPrice(Double totalPrice) {
		this.totalPrice = totalPrice;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "chufangInfo")
	public Set<ChufangItmes> getChufangItmeses() {
		return this.chufangItmeses;
	}

	public void setChufangItmeses(Set<ChufangItmes> chufangItmeses) {
		this.chufangItmeses = chufangItmeses;
	}

}